package com.core.springaop.observer;

import com.core.springaop.Point;

import java.lang.reflect.Method;

public class BeforObserver implements Observer {
    @Override
    public void update(String type, Point point) {
        if ("befor".equals(type)) {
            Method m = point.getMethod();
            Object[] args = new Object[m.getParameters().length];

            try {
                m.invoke(point.getAscept(), args);
            } catch (Exception e) {
                e.printStackTrace();
            }

        }
    }
}
